package cn.websocket.controller;

import cn.websocket.service.MinioService;
import cn.websocket.vo.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * <h3>WebSocket</h3>
 * <p>
 *     同一文件上传接口
 * </p>
 *
 * @author gdw
 * @since 2025-08-19 15:27:16
 */
@RestController
@RequestMapping("/files/")
@RequiredArgsConstructor
public class FileController {
    private final MinioService minioService;

    //上传方法
    @PostMapping("upload")
    public Result<Object> upload(@RequestParam("file") MultipartFile file) throws Exception {
        return minioService.uploadFile(file);
    }

}
